Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto-layer-releases flow to deploy flow #1274

Merged
merged 8 commits into from
Jan 10, 2025

Conversation

hmstepanek
Copy link
Contributor

Overview

Move auto-layer-releases flow from lambda to GHA.

@hmstepanek hmstepanek requested a review from a team as a code owner December 16, 2024 20:15
Copy link

github-actions bot commented Dec 16, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ YAML prettier 1 0 0 0.38s
✅ YAML v8r 1 0 2.0s
✅ YAML yamllint 1 0 0.29s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@codecov-commenter
Copy link

codecov-commenter commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.61%. Comparing base (4c06d26) to head (3de90db).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1274      +/-   ##
==========================================
- Coverage   79.68%   79.61%   -0.08%     
==========================================
  Files         201      201              
  Lines       22174    22174              
  Branches     3519     3519              
==========================================
- Hits        17669    17653      -16     
- Misses       3355     3362       +7     
- Partials     1150     1159       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -0,0 +1,70 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#!/bin/bash
#!/usr/bin/env python3

Comment on lines 19 to 38
# How to use this script:
# Set the following env vars:
# * GH_RELEASE_TOKEN
# * LAMBDA_RUNTIME (optional)
# * INITCONTAINER_RUNTIME (optional)
# * AGENT_VERSION
# * DRY_RUN (optional) set to 1 to run the flow without creating the release tag.
#
# Lambda runtime options:
# nodejs
# python
# ruby
# dotnet
#
# Initcontainer runtime options:
# nodejs
# python
# ruby
# java
# dotnet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you make those a constant, so we don't have to set those as env vars? Presumably each repo will have a separate copy of this script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well...I was still thinking of making it shared at this point (even though I realize I haven't done that in this PR). I guess TBD on that.

Comment on lines 59 to 60
tag_name = f"{latest_version}.0_{runtime}"
release_name = f"New Relic {runtime} Agent {latest_version}.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This originally had logic to have release names and release tags as different strings. For Python the only difference was capitalization, but for Node and .NET it was Node -> nodejs, and .NET -> dotnet.

Why not make constants for TAG_SUFFIX="python" and RUNTIME_NAME="Python". Then maybe use bool constants to toggle on/off the lambda and initcontainer releases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooh you're totally right! I was trying to simplify those out but they were used for the release name-I'll put those back I guess. Instead of a boolean I was thinking each team could just set the value of those and that way the work flow could be shared across all teams-I need to look into that more though to see if we can do that.

@TimPansino
Copy link
Contributor

As a general thought, is there a reason not to convert this to bash scripting and use the gh CLI? Seems like it would be easier for other teams to manage, and we could then just add the code directly into the release flow as a step.

@hmstepanek
Copy link
Contributor Author

As a general thought, is there a reason not to convert this to bash scripting and use the gh CLI? Seems like it would be easier for other teams to manage, and we could then just add the code directly into the release flow as a step.

I was actually thinking about this after I pushed this up as a Python script. Since we seem to both have had that thought, I'll just go ahead and do that. I agree-it would be easier to maintain that way for each team in the long run.

@hmstepanek hmstepanek force-pushed the add-layers-release-flow-to-gha branch from ad59deb to 30b2816 Compare December 17, 2024 23:12
@hmstepanek hmstepanek force-pushed the add-layers-release-flow-to-gha branch from 690b061 to 9ac223d Compare January 6, 2025 21:53
@@ -182,3 +182,16 @@ jobs:
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

- name: Create release tags for Lambda and K8s Init Containers
uses: dev-hanz-ops/install-gh-cli-action@c78dbed4be2f8d6133a14a9a597ee12fd4ed5c93 # v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gh should be preinstalled on all runners, I think this 3rd party action is unnecessary.

https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-github-cli-in-workflows

@hmstepanek hmstepanek requested a review from TimPansino January 7, 2025 01:19
@hmstepanek hmstepanek requested a review from TimPansino January 9, 2025 22:27
@TimPansino
Copy link
Contributor

We've still got unrelated test issues to fix before we can merge this to main.

@hmstepanek hmstepanek merged commit e4ff798 into main Jan 10, 2025
44 of 56 checks passed
@hmstepanek hmstepanek deleted the add-layers-release-flow-to-gha branch January 10, 2025 00:26
@mergify mergify bot removed the tests-failing label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants